import path from "path";
import {fileURLToPath} from 'url'
import {getAppDataLocalPath} from "./src/utils/pathUtils.js";

// AppData目录在Windows系统通常位于用户主目录下的AppData\Local
let appDataLocal = getAppDataLocalPath()

// 当前文件路径
const __filenameNew = fileURLToPath(import.meta.url)
// 当前文件所在目录
const __dirnameNew = path.dirname(__filenameNew)

const resolve = (...args) => path.resolve(__dirnameNew, ...args)
const resolveAppDataLocal = (...args) => path.resolve(appDataLocal, ...args)

export default {
    "builderCacheList": [
        {
            // `C:\Users\用户名\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.4.1`
            name: 'nsis',
            version: '3.0.4.1',
            // from: path.join(__dirnameNew, '..', 'modules/nsis-3.0.4.1.7z'),
            from: resolve('modules/nsis-3.0.4.1.7z'),
            to: resolveAppDataLocal('electron-builder/Cache/nsis'),
            url: 'https://npmmirror.com/mirrors/electron-builder-binaries/nsis-3.0.4.1/nsis-3.0.4.1.7z'
        },
        {
            // `C:\Users\用户名\AppData\Local\electron-builder\Cache\nsis\nsis-resources-3.4.1`
            name: 'nsis-resources',
            version: '3.4.1',
            from: resolve('modules/nsis-resources-3.4.1.7z'),
            to: resolveAppDataLocal('electron-builder/Cache/nsis'),
            url: 'https://npmmirror.com/mirrors/electron-builder-binaries/nsis-resources-3.4.1/nsis-resources-3.4.1.7z'
        },
        {
            //`C:\Users\用户名\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.6.0`
            name: 'winCodeSign',
            version: '2.6.0',
            from: resolve('modules/winCodeSign-2.6.0.7z'),
            to: resolveAppDataLocal('electron-builder/Cache/winCodeSign'),
            url: 'https://npmmirror.com/mirrors/electron-builder-binaries/winCodeSign-2.6.0/winCodeSign-2.6.0.7z'
        }
    ],
    "electronCache": {
        "name": "electron",
        "version": "21.4.4",
        "platform":'win32',
        "arch": "x64",
        "mirror": "https://npmmirror.com/mirrors/electron/",
        "from": resolve('modules/electron-v21.4.4-win32-x64.zip'),
        "to": resolveAppDataLocal('electron/Cache')
    }
}
